 
 const webpack = require('webpack');
 const path = require('path');
 const HtmlWebpackPlugin = require('html-webpack-plugin');
 
 module.exports = {
 	devtool: 'source-map',
 	entry: {
 		main:path.resolve(__dirname, "./src/app.js")
 	},
 	output: {
 		path:path.resolve(__dirname,'./dist'),
 		filename: "[name].bundle.js",
 	},
 	module: {
 	  rules: [
 		{test: /\.css$/, use: ['style-loader','css-loader']},
 		{
 	      	test: /\.(png|jpg|gif|svg)$/,
        	use: ['url-loader?limit=100&name=images/[name].[ext]']
 	    },{
			test:/\.(js|jsx)$/,
			exclude:/node_modules/,
			use:{
				loader: 'babel-loader',
				options:{
					presets:['es2015','react']
				}
			}
		}]
 	},
 	resolve: {
 		extensions: ['.js', '.json', '.jsx'],
 		alias:{
 			assets: path.resolve(__dirname, './src/assets'),
 			components: path.resolve(__dirname, './src/components'),
 			config: path.resolve(__dirname, './src/config'),
 			action: path.resolve(__dirname, './src/action'),
 		}
 	},
 	devServer:{
		hot:true,
		inline:true,
 		port:2333,
 	},
 	plugins: [
 		new webpack.HotModuleReplacementPlugin(),
 		new webpack.NoErrorsPlugin(),
 		new HtmlWebpackPlugin({ 
 			template: './src/index.html', //html模板路径
 			inject: 'body', 
 			minify: { //压缩文件，去除空白和注释
 				removeComments: true, 
 				collapseWhitespace: false 
 			}
 		})
 	]
 };